package com.baobao.service;

import com.baobao.domain.Chat;

import java.util.Calendar;
import java.util.List;
import java.util.Set;

/**
 * Spring service that handles CRUD requests for Chat entities
 * 
 */
public interface ChatService {

	/**
	 * Return all Chat entity
	 * 
	 */
	public List<Chat> findAllChats(Integer startResult, Integer maxRows);

	/**
	 * Load an existing Chat entity
	 * 
	 */
	public Set<Chat> loadChats();

	/**
	 */
	public Chat findChatByPrimaryKey(String sender, String receiver, Calendar date);
	
	public Set<Chat> findChatByMaxDateAndPhone(String sender, String receiver);
	
	/**
	 */
	public Set<Chat> findChatByPhoneAndStatus(String sender, String receiver, String status);
	
	/**
	 * 读取最近n条群聊消息
	 */
	public Set<Chat> findChatByReceiverAndLatestMsgnum(String receiver,Calendar startDate,Integer msgnum);

	/**
	 * Save an existing Chat entity
	 * 
	 */
	public void saveChat(Chat chat);

	/**
	 * Delete an existing Chat entity
	 * 
	 */
	public void deleteChat(Chat chat_1);

	/**
	 * Return a count of all Chat entity
	 * 
	 */
	public Integer countChats();
}